<template>
	<view>
		<web-view v-if="url" :src="url" :update-title="false"></web-view>
	</view>
</template>

<script>
	var wv;
	export default {
		onReady() {
				var topg = uni.getSystemInfoSync()
				var currentWebview = this.$scope.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
				setTimeout(function() {
					wv = currentWebview.children()[0]
					wv.setStyle({'top':topg.statusBarHeight,'height':topg.screenHeight-topg.safeAreaInsets.bottom-30})
				}, 1000); //如果是页面初始化调用时，需要延时一下
			},
		data() {
			return {
				url: '',
				type:""
			}
		},
		mounted() {
			if(this.type==2){
				uni.setNavigationBarTitle({
					title: '火莲神签'
				})
				
				uni.setNavigationBarColor({
				    frontColor: '#ffffff',
				    backgroundColor: '#101217'
				})
			}else if(this.type==1){
				uni.setNavigationBarTitle({
					title: '客服系统'
				})
				uni.setNavigationBarColor({
				    frontColor: '#ffffff',
				    backgroundColor: '#333333'
				})
			}else if(this.type==3){
				uni.setNavigationBarTitle({
					title: '火莲展厅'
				})
				uni.setNavigationBarColor({
				    frontColor: '#ffffff',
				    backgroundColor: '#333333'
				})
			}
			
		},
		onLoad(option) {
			this.url = option.url
			this.type=option.type
		}

	}
</script>

<style>
	page{
		background: #fff;
	}
</style>